<?php

session_start();
include_once($_SERVER['DOCUMENT_ROOT'] ."/include/user/inc.php");
include_once($_SERVER['DOCUMENT_ROOT'] ."/config/mblog_config.php");
include_once($_SERVER['DOCUMENT_ROOT'] ."/core/mblog/weibooauth.php");
include_once($_SERVER['DOCUMENT_ROOT'] ."/include/mblog/db_sina_users.class.php");

$o = new WeiboOAuth( WB_AKEY , WB_SKEY , $_SESSION['keys']['oauth_token'] , $_SESSION['keys']['oauth_token_secret']  );

$last_key = $o->getAccessToken(  $_REQUEST['oauth_verifier'] ) ;
$db_sina_users = new db_sina_users();

$res = $db_sina_users->insert_sina_user($last_key["user_id"],$last_key["oauth_token"],$last_key["oauth_token_secret"]);

$_SESSION['last_key'] = $last_key;

header("location:{$_GET["url"]}");
exit;



?>

